
function ajax(url) {
    var xmlHTTP = new XMLHttpRequest()
    xmlHTTP.open("post",url,true)
    xmlHTTP.send()
    xmlHTTP.onreadystatechange = function () {
        if (xmlHTTP.readyState == 4 && xmlHTTP.status == 200) {
            console.log(xmlHTTP.responseText);
        }
    }
}

function commonAjax(data, deturl, successFn) {
    $.ajax({
        url: deturl,
        type: 'get',
        dataType: 'json',
        contentType: 'application/json',
        data: data,
        success: function(result){
            if(result){
                successFn(result)
            }else{
                alert('请检查网络连接');
            }
        },
        error: function(err){
            alert(err)
        }
    })
}

function commonAjax_post(data, deturl, successFn) {
    $.ajax({
        url: deturl,
        type: 'post',
        dataType: 'json',
        contentType: 'application/json',
        data: data,
        success: function(result){
            if(result){
                successFn(result)
            }else{
                alert('请检查网络连接');
            }
        },
        error: function(err){
            alert(err)
        }
    })
}